
#ifndef ALORITHM_C___BASESORT_H
#define ALORITHM_C___BASESORT_H


#include <ctime>
#include <cassert>
#include <iostream>
#include <random>

using namespace std;


class SortTestHelper {
    /*
* 生成有n个元素的随机数组，每个元素的随机范围为[rangeL,rangeR]
*/
public:
    inline static int *generateRandomArray(int n, int rangeL, int rangeR) {
        assert(rangeL <= rangeR);

        int *arr = new int[n];
        default_random_engine engine(time(nullptr));  /*用时间初始化种子，所以每次结果不一样*/
        uniform_int_distribution<int> u(rangeL, rangeR); /* 产生的随机数范围在0~100之间*/

        for (int i = 0; i < n; i++)
            arr[i] = u(engine);
        return arr;
    }

    template<typename T>
    inline static void printArray(T arr[], int n) {

        for (int i = 0; i < n; i++)
            cout << arr[i] << " ";
        cout << endl;
    }

};

#endif //ALORITHM_C___BASESORT_H


